<template>
  <div>
    <input type="file" name="file" @change="fileChange" multiple />
    <img style="width:200px;height: 150px; display: flex;" :src="imgbase64">
    <button @click="submit">提交</button>
  </div>
</template>

<script>

export default {
  name: "photo",
  data() {
    return {
      imgbase64: "",
    }
  },
  methods: {
    fileChange(e) {
      let file = e.target.files[0]
      let _sliceBlob = new Blob([file].slice(0, 5000));
      let _sliceFile = new File([_sliceBlob], "test.png");
      let fr = new FileReader();
      fr.readAsDataURL(_sliceFile);
      let self = this;
      fr.onload = function () {
        self.imgbase64 = fr.result
      }
    },
    async submit() {

    }
  }
}
</script>

<style></style>
